< previous page page_535 next page >

Page 535
TABLE 19.1. NEW BASIC LANGUAGE FUNCTIONS INCLUDED WITH VISUAL BASIC 6.
NameDescription
FilterReturns a zero-based array containing a subset of the original array based on a specified value
ReplaceReturns a string where a specified substring has been replaced with a new substring wherever it was found
RoundReturns a number rounded to a specified number of decimal places
SplitReturns an array containing a specified number of substrings from a single string expression
StrReverseReverses the character order of a specified string
JoinReturns a string created by joining all the elements in a string array
WeekdayNameReturns the name of the specified day of the week
MonthNameReturns the name of the specified month

In addition to these new functions, there are several new formatting functions that you can use. The name of these functions basically explain their function and are as follows:
FormatCurrency
FormatDateTime
FormatNumber
FormatPercent
Avoid Using Variant Variables
You should know that the default data type in Visual Basic is Variant. But because Visual Basic converts all Variant types to the appropriate data type at runtime, any operations involving other simple data types will eliminate this extra step and are faster than their Variant equivalents.
To avoid Variant data types from being defined for you, you should use the OptionExplicit statement in the application, which forces you to declare all your variables.
Use Long Integer Variables and Integer Math
If your application performs complex arithmetic operations, you should avoid using Currency, Single, and Double variables. Use Long integer variables whenever you can, particularly in loops; because the Long integer is the 32-bit CPU's native data type, operations that use such integers are very fast. If you can't use Long variables, the Integer or Byte data types are the next best choice.

 
< previous page page_535 next page >

If you like this book, buy it!